package com.netease.pris.activity;

import android.app.AlertDialog;
import android.app.AlertDialog.Builder;
import android.app.Dialog;
import android.content.Context;
import android.content.Intent;
import android.content.res.Resources;
import android.graphics.Bitmap;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
import android.text.TextUtils;
import android.util.DisplayMetrics;
import android.view.Display;
import android.view.KeyEvent;
import android.view.LayoutInflater;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.View.OnCreateContextMenuListener;
import android.view.ViewGroup.MarginLayoutParams;
import android.view.Window;
import android.view.WindowManager;
import android.view.WindowManager.LayoutParams;
import android.view.animation.AccelerateInterpolator;
import android.view.animation.Animation;
import android.view.animation.AnimationUtils;
import android.widget.AdapterView.OnItemClickListener;
import android.widget.CheckBox;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.LinearLayout.LayoutParams;
import android.widget.ProgressBar;
import android.widget.RelativeLayout;
import android.widget.TextView;
import android.widget.Toast;
import com.netease.framework.ActivityEx;
import com.netease.framework.k;
import com.netease.pris.activity.view.FlingGallery;
import com.netease.pris.activity.view.RelativeLayoutEx;
import com.netease.pris.activity.view.TouchInterceptor;
import com.netease.pris.activity.view.bw;
import com.netease.pris.activity.view.cb;
import com.netease.pris.activity.view.pageList;
import com.netease.pris.app.PrisApp;
import com.netease.pris.atom.g;
import com.netease.pris.heartbeat.AndroidHeartBeatService;
import com.netease.update.CheckVersionService;
import java.util.HashMap;
import java.util.Iterator;
import java.util.LinkedList;

public class MainGridActivity extends ActivityEx
{
  private static final String G = "MainGridActivity";
  private static final String H = "state";
  private static final String I = "change_user";
  private static final boolean J = false;
  public static final int a = 0;
  private static final int aj = 8;
  private static final int ak = 2;
  private static final int al = 3;
  private static final int am = -2;
  private static final int an = 32;
  private static final int ao = 7200000;
  private static final long ap = 1500L;
  public static final int b = 1;
  public static final int c = 2;
  public static final int d = 3;
  public static final int e = 4;
  public static final int f = 5;
  public static final int g = 6;
  public static final int h = 7;
  public static final int i = 8;
  public static final int j = 2;
  public static final int k = 1;
  public static final int l = 2;
  public static final int m = 3;
  public static final int n = 4;
  public static final int o = 5;
  public static final int p = 6;
  public static final int q = 7;
  public static final int r = 8;
  public static final int s = 256;
  public static final int t = 257;
  public static final int u = 258;
  public static final int v = 259;
  public static final int w = 260;
  public static final int x = 261;
  public static final String y = "extra_is_refresh_screen";
  View.OnCreateContextMenuListener A = new o(this);
  AdapterView.OnItemClickListener B = new s(this);
  com.netease.pris.b C = new ak(this);
  f D = new ac(this);
  View.OnClickListener E = new ab(this);
  Handler F = new aa(this);
  private boolean K = false;
  private int L = 0;
  private int M = 0;
  private int N = 0;
  private boolean O = false;
  private boolean P = false;
  private int Q = 0;
  private Context R = null;
  private ImageView S = null;
  private TextView T;
  private ProgressBar U = null;
  private LinearLayout V;
  private RelativeLayout W;
  private int X = 0;
  private int Y = 0;
  private int Z = 0;
  private fh aA;
  private int aB = 0;
  private boolean aC = false;
  private bc aD = bc.a;
  private final int aE = 60;
  private Bitmap aF;
  private ImageView aG;
  private com.netease.pris.heartbeat.a aH = new n(this);
  private boolean aI;
  private boolean aJ = false;
  private dj aK = new dj(this, null);
  private boolean aL = false;
  private bw aM = new z(this);
  private com.netease.b.b.e.e aN = new y(this);
  private cb aO = new x(this);
  private int aa = 0;
  private LinkedList ab;
  private LinkedList ac;
  private HashMap ad;
  private FlingGallery ae;
  private com.netease.pris.activity.a.d af;
  private pageList ag;
  private int ah;
  private int ai = 0;
  private int aq;
  private ed ar;
  private View as;
  private TouchInterceptor at;
  private fw au;
  private cr av;
  private float aw = -1.0F;
  private float ax = -1.0F;
  private Animation ay;
  private Animation az;
  protected boolean z = false;

  private void A()
  {
    z();
    if (this.at != null)
      this.at.a(true);
  }

  private float B()
  {
    return getResources().getDisplayMetrics().density;
  }

  private com.netease.pris.atom.u a(int paramInt)
  {
    com.netease.pris.atom.u localu = null;
    if ((this.ab != null) && (paramInt >= 0) && (paramInt < this.ab.size()))
      localu = (com.netease.pris.atom.u)this.ab.get(paramInt);
    return localu;
  }

  private com.netease.pris.atom.u a(LinkedList paramLinkedList, String paramString)
  {
    com.netease.pris.atom.u localu;
    if ((paramLinkedList == null) || (TextUtils.isEmpty(paramString)))
      localu = null;
    while (true)
    {
      return localu;
      Iterator localIterator = paramLinkedList.iterator();
      while (true)
        if (localIterator.hasNext())
        {
          localu = (com.netease.pris.atom.u)localIterator.next();
          if ((localu == null) || (TextUtils.isEmpty(localu.V())) || (!localu.V().equals(paramString)))
            continue;
          break;
        }
      localu = null;
    }
  }

  private String a(long paramLong)
  {
    String str;
    if (paramLong <= 0L)
      str = "";
    while (true)
    {
      return str;
      long l1 = (System.currentTimeMillis() - paramLong) / 1000L;
      if (l1 < 60L)
      {
        Object[] arrayOfObject4 = new Object[2];
        arrayOfObject4[0] = Long.valueOf(l1);
        arrayOfObject4[1] = getString(2131362312);
        str = getString(2131362311, arrayOfObject4);
        continue;
      }
      if (l1 < 3600L)
      {
        Object[] arrayOfObject3 = new Object[2];
        arrayOfObject3[0] = Long.valueOf(l1 / 60L);
        arrayOfObject3[1] = getString(2131362313);
        str = getString(2131362311, arrayOfObject3);
        continue;
      }
      if (l1 < 86400L)
      {
        Object[] arrayOfObject2 = new Object[2];
        arrayOfObject2[0] = Long.valueOf(l1 / 3600L);
        arrayOfObject2[1] = getString(2131362314);
        str = getString(2131362311, arrayOfObject2);
        continue;
      }
      Object[] arrayOfObject1 = new Object[2];
      arrayOfObject1[0] = Long.valueOf(l1 / 86400L);
      arrayOfObject1[1] = getString(2131362315);
      str = getString(2131362311, arrayOfObject1);
    }
  }

  private HashMap a(int paramInt1, int paramInt2)
  {
    Object localObject1;
    if ((paramInt1 == paramInt2) || (paramInt2 >= -1 + this.ab.size()))
    {
      localObject1 = null;
      return localObject1;
    }
    HashMap localHashMap = new HashMap();
    com.netease.pris.atom.u localu1 = (com.netease.pris.atom.u)this.ab.get(paramInt2);
    int i1 = localu1.h();
    String str = localu1.V();
    if (paramInt1 < paramInt2)
    {
      int i3 = paramInt2 - 1;
      com.netease.pris.atom.u localu3;
      for (Object localObject3 = localu1; i3 >= paramInt1; localObject3 = localu3)
      {
        localu3 = (com.netease.pris.atom.u)this.ab.get(i3);
        localHashMap.put(str, Integer.valueOf(localu3.h()));
        ((com.netease.pris.atom.u)localObject3).b(localu3.h());
        str = localu3.V();
        i3--;
      }
      ((com.netease.pris.atom.u)localObject3).b(i1);
      localHashMap.put(str, Integer.valueOf(i1));
      this.ab.add(paramInt2 + 1, localObject3);
      this.ab.remove(paramInt1);
    }
    while (true)
    {
      localObject1 = localHashMap;
      break;
      int i2 = paramInt2 + 1;
      com.netease.pris.atom.u localu2;
      for (Object localObject2 = localu1; i2 <= paramInt1; localObject2 = localu2)
      {
        localu2 = (com.netease.pris.atom.u)this.ab.get(i2);
        localHashMap.put(str, Integer.valueOf(localu2.h()));
        ((com.netease.pris.atom.u)localObject2).b(localu2.h());
        str = localu2.V();
        i2++;
      }
      ((com.netease.pris.atom.u)localObject2).b(i1);
      localHashMap.put(str, Integer.valueOf(i1));
      this.ab.remove(paramInt1);
      this.ab.add(paramInt2, localObject2);
    }
  }

  private void a(int paramInt, Object paramObject, String paramString1, String paramString2)
  {
    switch (paramInt)
    {
    default:
      return;
    case 1:
      this.L = com.netease.pris.v.a().a(paramString1, paramString2, 0);
    case 308:
    case 313:
    case 300:
    case 303:
    case 3:
    case 301:
    case 5:
    }
    while (true)
    {
      this.ac.add(new Integer(this.L));
      break;
      this.L = com.netease.pris.v.a().a(this.ab);
      continue;
      this.L = com.netease.pris.v.a().a((LinkedList)paramObject, c(), b());
      continue;
      if (paramObject != null);
      for (boolean bool = ((Boolean)paramObject).booleanValue(); ; bool = false)
      {
        if (!bool)
          break label192;
        this.L = com.netease.pris.v.a().h();
        break;
      }
      label192: String str = com.netease.b.a.d.h().c();
      if ((this.M == 1) && (com.netease.pris.c.h.e(this.R, str)))
      {
        com.netease.pris.c.h.a(this.R, str, false);
        this.L = com.netease.pris.v.a().a(true);
        continue;
      }
      this.L = com.netease.pris.v.a().a(false);
      continue;
      this.L = com.netease.pris.v.a().b((com.netease.pris.atom.u)paramObject);
      continue;
      this.L = com.netease.pris.v.a().i();
      continue;
      this.L = com.netease.pris.v.a().g();
      continue;
      this.L = com.netease.pris.v.a().m();
    }
  }

  public static void a(Context paramContext, int paramInt1, int paramInt2)
  {
    a(paramContext, paramInt1, false, paramInt2);
  }

  public static void a(Context paramContext, int paramInt1, boolean paramBoolean, int paramInt2)
  {
    Intent localIntent = new Intent(paramContext, MainGridActivity.class);
    localIntent.addFlags(67108864);
    localIntent.putExtra("state", paramInt1);
    localIntent.putExtra("change_user", paramBoolean);
    localIntent.putExtra("extra_is_refresh_screen", paramInt2);
    paramContext.startActivity(localIntent);
  }

  private void a(Intent paramIntent)
  {
    boolean bool1;
    if (paramIntent != null)
    {
      this.M = paramIntent.getIntExtra("state", 0);
      bool1 = paramIntent.getBooleanExtra("change_user", false);
      this.K = bool1;
    }
    while (true)
    {
      String str = com.netease.pris.b.a.c();
      if ((str != null) && (!str.equals(com.netease.b.a.d.h().c())))
        com.netease.b.a.d.h().a(str, com.netease.pris.b.a.g());
      boolean bool2;
      if (bool1)
      {
        bool2 = false;
        switch (this.M)
        {
        default:
        case 0:
        case 7:
        case 1:
        }
      }
      while (true)
      {
        return;
        if (!PRISActivitySetting.e(this.R))
        {
          bool2 = true;
          break;
        }
        bool2 = false;
        break;
        if (com.netease.pris.b.a.n())
        {
          com.netease.pris.b.a.d(false);
          a(3, null, null, null);
          com.netease.pris.v.a().a(com.netease.h.b.a);
          com.netease.pris.d.c.d("");
          continue;
        }
        a(300, Boolean.valueOf(bool2), null, null);
        y();
        continue;
        this.M = 1;
        a(300, Boolean.valueOf(bool2), null, null);
        continue;
        a(300, null, null, null);
        y();
        if (this.at == null)
          continue;
        this.at.a(false);
      }
      bool1 = false;
    }
  }

  private void a(bc parambc)
  {
    if (bc.a == parambc)
    {
      b(true);
      com.netease.pris.d.c.a(p(), 545);
    }
    while (true)
    {
      return;
      b(false);
      com.netease.pris.d.c.a(p(), 546);
    }
  }

  private void a(com.netease.pris.atom.b paramb)
  {
    if (this.ab != null)
    {
      LinkedList localLinkedList = new LinkedList();
      Iterator localIterator = this.ab.iterator();
      while (localIterator.hasNext())
      {
        com.netease.pris.atom.u localu = (com.netease.pris.atom.u)localIterator.next();
        if ((localu == null) || (localu.be() != paramb))
          continue;
        localLinkedList.add(localu);
      }
      if (localLinkedList.size() > 0)
        com.netease.pris.v.a().a(new com.netease.pris.protocol.d(localLinkedList));
    }
  }

  private void a(com.netease.pris.atom.u paramu, boolean paramBoolean)
  {
    if (paramu == null);
    while (true)
    {
      return;
      if (paramu.V().equals("-1"))
      {
        MallListActivity.a(this.R);
        com.netease.pris.d.c.a(p(), 1560);
        continue;
      }
      if (PRISActivityWBSetting.a(this, paramu.be()))
        continue;
      if (a(paramu))
      {
        Toast.makeText(this.R, 2131361901, 0).show();
        continue;
      }
      String str = paramu.b(g.b);
      if (str == null)
      {
        com.netease.pris.atom.b localb = paramu.be();
        if (paramu.x())
        {
          paramu.e(false);
          com.netease.pris.v.a().c(paramu);
          continue;
        }
        if ((localb != com.netease.pris.atom.b.c) && (localb != com.netease.pris.atom.b.b))
          continue;
        com.netease.pris.v.a().c(paramu);
        com.netease.pris.a.h.a(this, 2131361851);
        continue;
      }
      SubsSourceActivity.a(this.R, str, paramu);
      if (!paramBoolean)
        continue;
      com.netease.pris.d.c.a(p(), 1567, paramu.U());
    }
  }

  private void a(com.netease.pris.protocol.d paramd)
  {
    if (paramd == null);
    while (true)
    {
      return;
      com.netease.pris.atom.u localu = new com.netease.pris.atom.u();
      localu.q("-1");
      if (!paramd.h.contains(localu))
        paramd.h.addLast(localu);
      this.ab.clear();
      this.ab.addAll(paramd.h);
      this.z = true;
      a(null);
    }
  }

  /** @deprecated */
  private void a(LinkedList paramLinkedList)
  {
    int i1 = 0;
    monitorenter;
    while (true)
    {
      try
      {
        if (this.aD == bc.a)
        {
          if (paramLinkedList == null)
            continue;
          int i2 = 0;
          if (i2 >= paramLinkedList.size())
            continue;
          com.netease.pris.atom.u localu = (com.netease.pris.atom.u)paramLinkedList.get(i2);
          this.ae.a(localu.V());
          i2++;
          continue;
          if (!this.aC)
            continue;
          if (this.z)
            continue;
          this.aC = false;
          return;
          b(getString(2131362289));
          i1 = 200;
          this.F.postDelayed(new q(this), i1);
          this.z = false;
          continue;
        }
      }
      finally
      {
        monitorexit;
      }
      this.au.notifyDataSetChanged();
    }
  }

  private void a(boolean paramBoolean, com.netease.pris.atom.u paramu, int paramInt, View paramView)
  {
    com.netease.pris.c.c.a(this, com.netease.b.a.d.h().c(), paramu.V(), paramBoolean);
    paramu.b(paramBoolean);
    if ((paramView instanceof RelativeLayoutEx))
    {
      ((RelativeLayoutEx)paramView).a(paramBoolean);
      paramView.invalidate();
    }
  }

  private boolean a(com.netease.pris.atom.u paramu)
  {
    int i1 = 1;
    if (PRISActivitySetting.i(this.R))
      switch (paramu.av())
      {
      default:
      case 512:
      case 2048:
      }
    for (i1 = 0; ; i1 = 0)
      return i1;
  }

  private boolean a(com.netease.pris.atom.u paramu, int paramInt1, int paramInt2, View paramView)
  {
    if (paramu == null);
    while (true)
    {
      return true;
      if (paramu.V().equals("-1"))
      {
        MallListActivity.a(this.R);
        continue;
      }
      switch (paramInt1)
      {
      default:
        break;
      case 256:
        a(paramu, false);
        com.netease.pris.d.c.a(p(), 1561, paramu.U());
        break;
      case 257:
        SubsInfoActivity.a(this.R, paramu);
        com.netease.pris.d.c.a(p(), 1562, paramu.U());
        break;
      case 258:
        SubsInfoActivity.a(this.R, paramu, true);
        com.netease.pris.d.c.a(p(), 1563, paramu.U());
        break;
      case 259:
        if (this.D != null)
          this.D.a(paramInt2);
        com.netease.pris.d.c.a(p(), 1564, paramu.U());
        break;
      case 260:
        a(false, paramu, paramInt2, paramView);
        com.netease.pris.d.c.a(p(), 1566, paramu.U());
        break;
      case 261:
        a(true, paramu, paramInt2, paramView);
        com.netease.pris.d.c.a(p(), 1565, paramu.U());
      }
    }
  }

  private void b(int paramInt)
  {
    Object localObject = new AlertDialog.Builder(this.R);
    switch (paramInt)
    {
    default:
    case 4:
    case 5:
    case 6:
    case 3:
    case 7:
    case 8:
    }
    while (true)
    {
      ((AlertDialog.Builder)localObject).show();
      return;
      ((AlertDialog.Builder)localObject).setIcon(2130837548);
      ((AlertDialog.Builder)localObject).setTitle(2131361889);
      ((AlertDialog.Builder)localObject).setMessage(2131361890);
      ((AlertDialog.Builder)localObject).setPositiveButton(2131361833, new u(this));
      continue;
      ((AlertDialog.Builder)localObject).setIcon(17301543);
      ((AlertDialog.Builder)localObject).setTitle(2131361891);
      ((AlertDialog.Builder)localObject).setMessage(2131361892);
      v localv = new cls_v(this);
      ((AlertDialog.Builder)localObject).setPositiveButton(2131361895, localv);
      ((AlertDialog.Builder)localObject).setNegativeButton(2131362326, localv);
      continue;
      ((AlertDialog.Builder)localObject).setIcon(17301659);
      ((AlertDialog.Builder)localObject).setTitle(2131361893);
      ((AlertDialog.Builder)localObject).setMessage(2131361894);
      w localw = new w(this);
      ((AlertDialog.Builder)localObject).setPositiveButton(2131361833, localw);
      ((AlertDialog.Builder)localObject).setNegativeButton(2131361896, localw);
      continue;
      if (PrisApp.a().y())
      {
        AlertDialog.Builder localBuilder = new AlertDialog.Builder(this);
        View localView = getLayoutInflater().inflate(2130903080, null);
        ((CheckBox)localView.findViewById(2131558528)).setOnCheckedChangeListener(new ar(this));
        localBuilder.setView(localView);
        localBuilder.setIcon(2130837639);
        localBuilder.setTitle(2131361885);
        this.O = true;
        localBuilder.setPositiveButton(2131361874, new aq(this));
        localBuilder.setNegativeButton(2131362326, new an(this));
        localObject = localBuilder;
        continue;
      }
      localObject = new AlertDialog.Builder(this);
      ((AlertDialog.Builder)localObject).setIcon(2130837643);
      ((AlertDialog.Builder)localObject).setTitle(2131361885);
      ((AlertDialog.Builder)localObject).setMessage(2131361884);
      ((AlertDialog.Builder)localObject).setPositiveButton(2131361833, new am(this));
      ((AlertDialog.Builder)localObject).setNegativeButton(2131362326, new ap(this));
      continue;
      ((AlertDialog.Builder)localObject).setIcon(2130837639);
      ((AlertDialog.Builder)localObject).setTitle(2131361902);
      ((AlertDialog.Builder)localObject).setMessage(2131361903);
      ((AlertDialog.Builder)localObject).setPositiveButton(2131361904, new ao(this));
      ((AlertDialog.Builder)localObject).setNegativeButton(2131361905, new aj(this));
      continue;
      ((AlertDialog.Builder)localObject).setIcon(2130837639);
      ((AlertDialog.Builder)localObject).setTitle(2131361906);
      ((AlertDialog.Builder)localObject).setMessage(2131361907);
      ((AlertDialog.Builder)localObject).setPositiveButton(2131361904, new ai(this));
      ((AlertDialog.Builder)localObject).setNegativeButton(2131361905, new al(this));
    }
  }

  private void b(LinkedList paramLinkedList)
  {
    if (paramLinkedList == null);
    while (true)
    {
      return;
      Iterator localIterator = paramLinkedList.iterator();
      while (localIterator.hasNext())
        ((com.netease.pris.atom.u)localIterator.next());
    }
  }

  private void b(boolean paramBoolean)
  {
    Object localObject;
    if (paramBoolean)
    {
      localObject = this.as;
      if (this.aw < -0.01D)
      {
        this.aw = (this.as.getWidth() / 2.0F);
        this.ax = (this.as.getHeight() / 2.0F);
      }
      if (this.az != null)
        break label140;
      this.az = AnimationUtils.loadAnimation(this, 2130968588);
      this.az.setDuration(500L);
      this.az.setFillAfter(true);
      this.az.setInterpolator(new AccelerateInterpolator());
      this.aA = new fh(this, paramBoolean);
      this.az.setAnimationListener(this.aA);
    }
    while (true)
    {
      ((View)localObject).startAnimation(this.az);
      return;
      localObject = this.at;
      break;
      label140: if (this.aA == null)
      {
        this.aA = new fh(this, paramBoolean);
        this.az.setAnimationListener(this.aA);
        continue;
      }
      this.aA.a(paramBoolean);
    }
  }

  private void e()
  {
    this.at = ((TouchInterceptor)getLayoutInflater().inflate(2130903067, null));
    this.au = new fw(this, null);
    this.at.setAdapter(this.au);
    this.at.setOnItemClickListener(this.B);
    this.at.a(this.aM);
    this.at.setOnCreateContextMenuListener(this.A);
  }

  private void f()
  {
    this.at.setAdapter(null);
    this.au = null;
    this.at = null;
    System.gc();
  }

  private void g()
  {
    long l1 = com.netease.pris.c.h.a(this, com.netease.b.a.d.h().c());
    if (l1 <= 0L);
    while (true)
    {
      return;
      Toast.makeText(this, a(l1), 1).show();
    }
  }

  private void h()
  {
    if (this.as == null)
      throw new RuntimeException("mGridView is null! You should not see this");
    this.aD = bc.a;
    setContentView(this.as);
  }

  private void r()
  {
    this.aD = bc.b;
    if (this.at == null)
      throw new RuntimeException("mListView is null! You should not see this.");
    setContentView(this.at);
  }

  private void s()
  {
    int i1 = 0;
    if (!com.netease.pris.a.e.a())
    {
      b(4);
      if (i1 != 0)
      {
        if (!PrisApp.a().y())
          break label147;
        com.netease.pris.a.h.a(this.R, 2131362304);
      }
    }
    while (true)
    {
      return;
      if (!PrisApp.a().j())
      {
        b(5);
        continue;
      }
      switch (PrisApp.a().t())
      {
      case 2:
      default:
        i1 = 1;
        break;
      case 1:
        if (PRISActivitySetting.f(this.R) == cm.b)
        {
          i1 = 1;
          break;
        }
        b(6);
        break;
      case 3:
        if (PRISActivitySetting.f(this.R) == cm.b)
        {
          i1 = 1;
          break;
        }
        b(6);
        break;
        label147: if (com.netease.pris.c.c.e(this.R, com.netease.b.a.d.h().c()) > 0)
        {
          com.netease.pris.a.h.a(this.R, 2131361888);
          PrisApp.a().a(new Handler());
          continue;
        }
        b(8);
      }
    }
  }

  private void t()
  {
    this.S = ((ImageView)findViewById(2131558408));
    this.T = ((TextView)findViewById(2131558409));
    this.U = ((ProgressBar)findViewById(2131558411));
    this.V = ((LinearLayout)findViewById(2131558410));
    this.W = ((RelativeLayout)findViewById(2131558401));
  }

  private void u()
  {
    a(new LinearLayout.LayoutParams(-1, com.netease.image.c.a(this.R, 48.0F)));
    a(null);
    b(k.a(this).b(2130837688));
    if (this.S != null)
    {
      this.S.setImageDrawable(k.a(this).b(2130837820));
      this.S.setVisibility(8);
    }
    if (this.T != null)
    {
      this.T.setBackgroundDrawable(k.a(this).b(2130837558));
      this.T.setVisibility(8);
      LinearLayout.LayoutParams localLayoutParams = (LinearLayout.LayoutParams)this.T.getLayoutParams();
      int i2 = (int)getResources().getDimension(2131296260);
      this.T.setPadding(i2, 0, i2, 0);
      localLayoutParams.leftMargin = i2;
      this.T.setLayoutParams(localLayoutParams);
    }
    this.V.setBackgroundDrawable(k.a(this).b(2130837697));
    this.V.setVisibility(0);
    this.U.setVisibility(0);
    int i1 = com.netease.image.c.a(this.R, 8.0F);
    LinearLayout localLinearLayout = (LinearLayout)findViewById(2131558405);
    ViewGroup.MarginLayoutParams localMarginLayoutParams = (ViewGroup.MarginLayoutParams)localLinearLayout.getLayoutParams();
    localMarginLayoutParams.setMargins(0, 0, i1, 0);
    localLinearLayout.setLayoutParams(localMarginLayoutParams);
  }

  private void v()
  {
    if (this.ae != null)
    {
      this.X = this.ae.getHeight();
      this.Y = this.ae.getWidth();
    }
    if ((this.X <= 0) && (this.Y <= 0))
    {
      Display localDisplay = getWindowManager().getDefaultDisplay();
      this.Y = localDisplay.getWidth();
      this.X = (-8 + (-32 + (-32 + (-52 + localDisplay.getHeight()))));
    }
    this.Z = 6;
    this.ah = (-2 + (-16 + this.X) / 3);
  }

  private void w()
  {
    if (this.S != null)
      this.S.setOnClickListener(this.E);
    if (this.T != null)
      this.T.setOnClickListener(this.E);
  }

  private void x()
  {
    b(7);
  }

  private void y()
  {
    this.F.removeCallbacks(this.aK);
    this.U.setVisibility(0);
    this.V.setVisibility(0);
    this.S.setVisibility(8);
    this.T.setVisibility(8);
  }

  private void z()
  {
    this.U.setVisibility(8);
    this.V.setVisibility(8);
    this.S.setVisibility(0);
    this.T.setVisibility(0);
    if (!this.aJ)
    {
      if (!this.aI)
        break label54;
      this.aL = true;
    }
    while (true)
    {
      return;
      label54: this.F.postDelayed(this.aK, 1500L);
    }
  }

  public int b()
  {
    return this.ah;
  }

  public int c()
  {
    return this.Y / 2;
  }

  protected boolean e_()
  {
    return true;
  }

  public void f_()
  {
    a(null);
    b(k.a(this).b(2130837688));
    if (this.S != null)
      this.S.setImageDrawable(k.a(this).b(2130837820));
    if (this.T != null)
      this.T.setBackgroundDrawable(k.a(this).b(2130837558));
    if (this.V != null)
      this.V.setBackgroundDrawable(k.a(this).b(2130837697));
    if (this.ag != null)
      this.ag.a();
    if (this.aG != null)
    {
      this.aG.setImageDrawable(k.a(this).b(2130837508));
      this.aG.setBackgroundColor(k.a(this).c(2131230960));
    }
    if (this.au != null)
      this.au.notifyDataSetChanged();
  }

  public void onCreate(Bundle paramBundle)
  {
    super.onCreate(paramBundle);
    this.aB = getWindow().getAttributes().windowAnimations;
    getWindow().setWindowAnimations(2131427343);
    PrisApp.a().o();
    this.ae = new FlingGallery(this);
    int i1 = com.netease.image.c.a(this, 8.0F);
    this.ae.a(i1);
    this.ae.a(new gf(this));
    this.ae.a(new el(this));
    this.ab = new LinkedList();
    this.ac = new LinkedList();
    this.ad = new HashMap();
    LinearLayout localLinearLayout = new LinearLayout(getApplicationContext());
    localLinearLayout.setOrientation(1);
    LinearLayout.LayoutParams localLayoutParams = new LinearLayout.LayoutParams(-1, 0);
    localLayoutParams.setMargins(i1, i1, i1, 0);
    localLayoutParams.weight = 1.0F;
    localLinearLayout.addView(this.ae, localLayoutParams);
    this.ag = new pageList(this);
    localLinearLayout.addView(this.ag, new LinearLayout.LayoutParams(-1, 32));
    this.ag.setGravity(17);
    this.ag.a(new bv(this));
    this.as = localLinearLayout;
    setContentView(localLinearLayout);
    this.aD = bc.a;
    this.R = this;
    this.Q = 0;
    com.netease.pris.v.a().a(this.C);
    com.netease.b.b.e.h.a().a(this.aN);
    t();
    w();
    u();
    a(getIntent());
    CheckVersionService.a(this, false);
    this.aq = com.netease.b.a.d.f();
    this.P = PRISActivitySetting.i(this);
    v();
    this.ar = new ed();
    this.ar.a(this.F);
    this.ar.a(this.aq);
    this.ar.a(this.Y / 2, this.ah);
    if ((!this.P) && (com.netease.pris.b.a.a()) && ((PrisApp.a().t() == 1) || (PrisApp.a().t() == 3)))
    {
      Message localMessage = this.F.obtainMessage(2);
      this.F.sendMessageDelayed(localMessage, 1000L);
    }
    a(5, null, null, null);
  }

  public Dialog onCreateDialog(int paramInt)
  {
    AlertDialog localAlertDialog = null;
    switch (paramInt)
    {
    default:
    case 2:
    }
    while (true)
    {
      return localAlertDialog;
      AlertDialog.Builder localBuilder = new AlertDialog.Builder(this);
      localBuilder.setIcon(2130837639);
      localBuilder.setTitle(2131361879);
      localBuilder.setMessage(2131361880);
      localBuilder.setPositiveButton(2131361881, new m(this));
      localBuilder.setNegativeButton(2131361882, new p(this));
      localAlertDialog = localBuilder.create();
    }
  }

  public void onDestroy()
  {
    super.onDestroy();
    com.netease.pris.v.a().b(this.C);
    if (this.C != null)
    {
      this.C.c();
      this.C = null;
    }
    com.netease.b.b.e.h.a().b(this.aN);
    if (this.ae != null)
      this.ae = null;
    if (this.ab != null)
    {
      this.ab.clear();
      this.ab = null;
    }
    if (this.ac != null)
    {
      this.ac.clear();
      this.ac = null;
    }
    if (this.ad != null)
    {
      this.ad.clear();
      this.ad = null;
    }
    if (this.ar != null)
    {
      this.ar.a();
      this.ar = null;
    }
    if (this.aF != null)
    {
      this.aF.recycle();
      this.aF = null;
    }
    AndroidHeartBeatService localAndroidHeartBeatService = AndroidHeartBeatService.a(getApplicationContext());
    if ((this.aH != null) && (localAndroidHeartBeatService.a(this.aH)))
    {
      localAndroidHeartBeatService.b(this.aH);
      this.aH = null;
    }
    com.netease.image.d.a().a(this.aq);
  }

  public boolean onKeyDown(int paramInt, KeyEvent paramKeyEvent)
  {
    boolean bool = true;
    if (4 == paramInt)
      if (n())
        o();
    while (true)
    {
      return bool;
      b(3);
      continue;
      bool = super.onKeyDown(paramInt, paramKeyEvent);
    }
  }

  protected void onNewIntent(Intent paramIntent)
  {
    super.onNewIntent(paramIntent);
    if (paramIntent.getIntExtra("extra_is_refresh_screen", 0) > 0);
    while (true)
    {
      return;
      setIntent(paramIntent);
      a(paramIntent);
    }
  }

  public boolean onOptionsItemSelected(MenuItem paramMenuItem)
  {
    switch (paramMenuItem.getItemId())
    {
    case 2131558716:
    case 2131558717:
    case 2131558718:
    case 2131558719:
    case 2131558720:
    case 2131558721:
    case 2131558722:
    case 2131558723:
    default:
    case 2131558715:
    case 2131558724:
    case 2131558725:
    case 2131558727:
    case 2131558726:
    case 2131558728:
    }
    while (true)
    {
      return super.onOptionsItemSelected(paramMenuItem);
      FavoriteListActivity.a(this.R);
      com.netease.pris.d.c.a(p(), 532);
      continue;
      MallListActivity.a(this.R);
      com.netease.pris.d.c.a(p(), 533);
      continue;
      if (this.M == 0)
      {
        LoginActivity.a(this, 0, 0);
        com.netease.pris.d.c.a(p(), 529);
        continue;
      }
      if (1 != this.M)
        continue;
      PRISActivityUserInfo.a(this, com.netease.b.a.d.h().c());
      com.netease.pris.d.c.a(p(), 531);
      continue;
      PRISActivitySetting.g(this);
      com.netease.pris.d.c.a(p(), 534);
      continue;
      s();
      com.netease.pris.d.c.a(p(), 530);
      continue;
      b(3);
    }
  }

  public void onPause()
  {
    super.onPause();
    this.aI = true;
  }

  public void onPrepareDialog(int paramInt, Dialog paramDialog)
  {
    com.netease.pris.atom.u localu = a(this.N);
    if (localu == null);
    while (true)
    {
      return;
      String str = localu.U();
      switch (paramInt)
      {
      case 2:
      default:
        break;
      case 1:
        paramDialog.setTitle(str);
      }
    }
  }

  public boolean onPrepareOptionsMenu(Menu paramMenu)
  {
    paramMenu.clear();
    MenuInflater localMenuInflater = getMenuInflater();
    if (this.M == 0)
      localMenuInflater.inflate(2131492868, paramMenu);
    while (true)
    {
      return super.onPrepareOptionsMenu(paramMenu);
      if (1 == this.M)
      {
        localMenuInflater.inflate(2131492867, paramMenu);
        continue;
      }
      if (7 != this.M)
        continue;
      localMenuInflater.inflate(2131492868, paramMenu);
    }
  }

  public void onResume()
  {
    boolean bool1 = com.netease.b.a.d.h().i();
    com.netease.image.d.a().e();
    PrisApp.a().o();
    if ((!bool1) && (this.M == 0))
    {
      this.M = 1;
      this.K = true;
      a(300, null, null, null);
      y();
    }
    while (true)
    {
      boolean bool2 = PRISActivitySetting.i(this);
      if (this.P != bool2)
      {
        this.z = true;
        a(null);
        this.P = bool2;
      }
      if (PrisApp.a().e())
      {
        be localbe = new be(this, null);
        be.a(localbe, PrisApp.a().d());
        localbe.execute(new Void[0]);
      }
      AndroidHeartBeatService localAndroidHeartBeatService = AndroidHeartBeatService.a(getApplicationContext());
      super.onResume();
      this.aI = false;
      if (this.aL)
      {
        this.aL = false;
        this.F.postDelayed(this.aK, 1500L);
      }
      if (!localAndroidHeartBeatService.a(this.aH))
      {
        com.netease.g.b.e("MainGridActivity", "register heart beat call-back");
        localAndroidHeartBeatService.a(this.aH, 7200000L);
      }
      return;
      if ((!bool1) || (1 != this.M))
        continue;
      this.M = 0;
      this.K = true;
      a(300, null, null, null);
      ek.a(this.R);
      Toast.makeText(this.R, 2131361794, 1).show();
    }
  }
}

/* Location:           D:\android\hack\dex2jar-0.0.9.8\classes_dex2jar.jar
 * Qualified Name:     com.netease.pris.activity.MainGridActivity
 * JD-Core Version:    0.6.0
 */